<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box {
            position: relative;
            width: 250px;
            height: 250px;
            margin: 100px auto;
            border: 1px solid #ccc;
            text-align: center;
        }
        
        .box img {
            position: absolute;
            width: 200px;
            height: 200px;
            top: 25px;
            left: 25px;
        }
        
        .close {
            position: absolute;
            top: -1px;
            left: -23px;
            width: 20px;
            height: 20px;
            border: 1px solid #ccc;
            line-height: 20px;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div class="box">
        淘宝二维码
        <img src="./img/ewm.jpg" alt="">
        <i class="close">×</i>
    </div>
    <script>
        //1.获取元素
        var close = document.querySelector('.close');
        var box = document.querySelector('.box');
        // 注册事件 事件处理程序
        close.onclick = function() {
            box.style.display = 'none';
        }
    </script>
</body>

</html>